//
//  NSObject+Extension.m
//  RunTime
//
//  Created by 宜必鑫科技 on 2017/11/8.
//  Copyright © 2017年 宜必鑫科技. All rights reserved.
//

//#import <Foundation/Foundation.h>
//#import <objc/runtime.h>
//
//@interface NSObject (Extension)
//@property (nonatomic, strong) NSArray *books;
//@end

#import "NSObject+Extension.h"
#ifndef YYSYNTH_DYNAMIC_PROPERTY_OBJECT
#define YYSYNTH_DYNAMIC_PROPERTY_OBJECT(_getter_, _setter_, _association_, _type_) \
- (void)_setter_ : (_type_)object { \
[self willChangeValueForKey:@#_getter_]; \
objc_setAssociatedObject(self, _cmd, object, OBJC_ASSOCIATION_ ## _association_); \
[self didChangeValueForKey:@#_getter_]; \
} \
- (_type_)_getter_ { \
return objc_getAssociatedObject(self, @selector(_setter_:)); \
}
#endif

@implementation NSObject (Extension)
//-(void)setBooks:(NSArray *)books{
//    objc_setAssociatedObject(self, @selector(setBooks:), books, OBJC_ASSOCIATION_RETAIN);
//}
//-(NSArray *)books{
//    return objc_getAssociatedObject(self, @selector(setBooks:));
//}
YYSYNTH_DYNAMIC_PROPERTY_OBJECT(books,setBooks,RETAIN, NSArray *);
@end













